<template>
  <div style="color: #666;margin:20px;padding-top:40px ">
<!--    <div class="pd-10" style="font-size: 20px;color: #3F5EFB;cursor: pointer">{{content}}</div>-->
    <div style="font-size: 14px;margin: 10px;">
      <i class="el-icon-user-solid"></i><span>{{sysMessage.createUser}}</span>
      <i class="el-icon-time" style="margin-left: 20px"></i><span>{{sysMessage.createTime}}</span>
    </div>
    <div style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
                margin:40px;padding: 40px 100px;font-size: 19px">
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{sysMessage.message}}
    </div>
    <div style="height: 24px;line-height: 24px;margin-left: 80%;cursor: pointer" @click="addLikeCount()">
      <el-button>
        <i class="el-icon-star-on" style="font-size:24px">点赞&nbsp;</i>
        <span style="font-size:24px">{{sysMessage.likeCount}}</span>
      </el-button>

    </div>
  </div>
</template>

<script>
export default {
  name: "MessageDetail",
  data() {
    return {
      sysMessage: {},
      content:'',
      user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {},
    }
  },
  computed:{

  },
  created() {
    this.load()
  },
  methods: {
    load() {
      const id=this.$route.query.id;
      this.request.get("/message/"+id).then(res => {
        this.sysMessage = res.data
        this.content=this.sysMessage.message.slice(0,4)+'......'
      })
    },
    // 更新点赞数
    addLikeCount(){
      this.sysMessage.likeCount++
      this.request.post("/message",this.sysMessage).then(res => {
      })
    }
  }
}
</script>

<style scoped>

</style>
